﻿using System.Web.Mvc;
using System.Web.Routing;
using Ninject;
using Ninject.Web.Mvc;
using PCE.Mvc.Filters;
using PCE.Mvc.Routing;

namespace PCE.Configuration.IoC.Web
{
	public class PceHttpApplication : NinjectHttpApplication
	{
		protected override IKernel CreateKernel()
		{
			var kernel = new StandardKernel();
			kernel.Load("*.dll");
			return kernel;
		}

		protected override void OnApplicationStarted()
		{
			base.OnApplicationStarted();

			AreaRegistration.RegisterAllAreas();

			new RouteRegistrator().Register(RouteTable.Routes);
			new GlobalFilterRegistrator().Register(GlobalFilters.Filters);
		}
	}
}